import request from '@/utils/request';

export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request('/member/page', {
    params,
  });
}
export async function removeRule(params) {
  return request(`member/${params}`, {
    method: 'DELETE',
  });
}
export async function getDictionary(params, id) {
  return request(
    id ?
    `common/dictionary/list/?module=${params}&parentId=${id}` :
    `common/dictionary/list/?module=${params}`,
  );
}
export async function addRule(params) {
  return request('/member', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function updateRule(params) {
  return request('/member', {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}
export async function getMember(params) {
  return request(`member/memberAccount/${params}`);
}
export async function uploadState(params) {
  return request(`member/${params.id}/${params.status}`, {
    method: 'PUT',
  });
}

export async function storeList(params) {
  return request(`/store/store/allList`, {
    params
  });
}
export async function exportVip(params) {
  return request(`/member/export`, {
    method: 'GET',
    data: params,
    responseType: 'blob',
  });
}
